<%- include ("../public/page_header.html")%>         


<div class="panel panel-default">              
    <div class="panel-heading">
      增加管理员
    </div>
    <div class="panel-body">
        <div class="table-responsive input-form">
            <form id="form" action="/<%=adminPath%>/manager/doAdd" method="post">
                <ul>
                    <li> <span>管理员名称：</span> <input type="text" name="username" id="username" /></li>

                    <li> <span>管理员密码：</span> <input type="password" name="password" id="password"/></li>
                    <li> <span>确认密码：</span> <input type="password" name="repassword" id="repassword"/></li>
                    <li> <span>管理员电话：</span> <input type="number" name="mobile" id="mobile"/></li>
                    <li> <span>管理员邮箱：</span> <input type="email" name="email" id="email"/></li>

                    <li> <span>状 态：</span>
                        <input type="radio" name="status" checked value="1" id="a" /> <label for="a">显示</label>
                        <input type="radio" name="status" value="0" id="b" /> <label for="b">隐藏</label>

                    </li>

                    <li>
                        <div class="error"></div>
                        <br/>
                        <button type="submit" class="btn btn-default">提交</button>
                    </li>

                </ul>


            </form>
        </div>
    </div>


</div>

<script>
    $("#form").submit(function () {
        let username = $("#username").val()
        let password = $("#password").val()
        let repassword = $("#repassword").val()

        if (!username.length) {
            $(".error").html("Error: 用户名不能为空")
            return false
        }
        if (password.length < 6) {
            $(".error").html("Error: 密码不能小于6位")
            return false
        }
        if (password !== repassword) {
            $(".error").html("Error: 两个密码不一致")
            return false
        }
        $(".error").html("")
        return true
    })
</script>

</body>
</html>